<?php

if(isset($_POST))
{

try{  

	 $connect = new PDO('mysql:host=localhost;dbname=basketbal','cas','cas');
	 $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	 $query = "UPDATE articles SET title = :title, text = :text WHERE ID = :ID";
	 $statement = $connect->prepare($query);
	 $sql_status = $statement->execute(
	  array(
	   ':ID'  => $_POST["ID"],
	   ':title'  => $_POST["title"],
	   ':text'  => $_POST['text']
	  )
	 );
	 $output = '';
	 if ($sql_status) {
	 	  $output = '
	  <div class="alert alert-success">
	   The article has been successfully updated
	  </div>
	  ';
	 } else {
	 	$output = "Something Wrong";
	 }

} catch (PDOException $e) {
    
    $output = $e->getMessage();
}

 echo $output;

}

?>